package com.cqut.forum.entity;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * @author yangxun
 * ModuleInformation entity
 */
@Entity
@Table(name = "module_information", catalog = "forum")
public class ModuleInformation implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer moduleInformationId;
	private String informationName;
	private String moduleCss;
	//private Set<Level> levels = new HashSet<Level>(0);
	//private Module module;
	//private User user;
	// Constructors
	private Set<Module> module = new HashSet<Module>(0);
	/** default constructor */
	public ModuleInformation() {
	}

	/** full constructor */
	public ModuleInformation(String moduleCss,Set<Module> module,String informationName
			/*User user,Set<Level> levels*/) {
		this.moduleCss = moduleCss;
		//this.levels = levels;
		//this.user = user;
		this.informationName = informationName;
		this.module = module;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "module_information_id", unique = true, nullable = false)
	public Integer getModuleInformationId() {
		return this.moduleInformationId;
	}

	public void setModuleInformationId(Integer moduleInformationId) {
		this.moduleInformationId = moduleInformationId;
	}

	@Column(name = "module_css", length = 200)
	public String getModuleCss() {
		return this.moduleCss;
	}

	public void setModuleCss(String moduleCss) {
		this.moduleCss = moduleCss;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "moduleInformation")
	public Set<Module> getModule() {
		return module;
	}

	public void setModule(Set<Module> module) {
		this.module = module;
	}

	@Column(name = "information_name", length = 20)
	public String getInformationName() {
		return informationName;
	}

	public void setInformationName(String informationName) {
		this.informationName = informationName;
	}

/*	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "moduleInformation")
	public Set<Level> getLevels() {
		return this.levels;
	}

	public void setLevels(Set<Level> levels) {
		this.levels = levels;
	}*/


/*
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id")
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}*/
}